package adata;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.RowSet;

import model.ReviewerModel;


import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import db.DbException;
import forms.ReviewerForm;

public class ChairsHomeAction extends Action{
	
	public ActionForward execute(ActionMapping mapping, ActionForm form, 
		    HttpServletRequest request, HttpServletResponse response) 
		    throws DbException{
		
	RowSet crsReviewers = ReviewerModel.getAllReviewers();
	RowSet crsCountReviewers = ReviewerModel.getReviewerCount();
	request.setAttribute("crsCountReviewers", crsCountReviewers);
	request.setAttribute("crsReviewers", crsReviewers);

//	ReviewerForm rf = (ReviewerForm) form;
//	if (rf.getCount() < 3){
//		return mapping.findForward("notStarted");
//	}else
//		return mapping.findForward("notStarted");
	
	if(ReviewerModel.determineStart()){
		return mapping.findForward("started");
	}else{
		return mapping.findForward("notStarted");
	}
	
//	
	
	
		
//	RowSet crsCountReviewers = ReviewerModel.getReviewerCount();
//	request.setAttribute("crsCountReviewers", crsCountReviewers);

	
		
	}

}
